/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"FAC7B2D6-F39B-43E9-AE41-460A04079169",variableType:8}
 */
var fIva_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"55010492-6551-4938-8FC4-DFB0875C7478",variableType:8}
 */
var fIva_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"3A0E31A2-D791-445D-B485-BC0A3D9732A0",variableType:8}
 */
var fIva_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"D6549546-E1BA-4C08-9A79-FCBDB76FB3BC",variableType:8}
 */
var fIva_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"9A211586-02BB-41BA-BB2E-A1FE36CF248F",variableType:8}
 */
var fNeto_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"D16FCF52-6E99-4D18-AF19-F2E3D817A18C",variableType:8}
 */
var fNeto_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"B22F7133-00A7-4070-8212-FB6E80460578",variableType:8}
 */
var fNeto_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"AFEE1D02-DE68-434D-8CF5-70E9C2820736",variableType:8}
 */
var fNeto_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"0B5F00D2-7DF6-4758-9581-CC527A4861E1",variableType:8}
 */
var porc_1 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"4B124918-E625-499C-A868-5D393D3E39C7",variableType:8}
 */
var porc_2 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"C64417FE-BEBA-4DF9-881A-FD68EB317283",variableType:8}
 */
var porc_3 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"BC4AE123-D1F1-46F5-B3AB-43998D0C6F1F",variableType:8}
 */
var porc_4 = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"0066D3E4-8FA7-4F86-AFF0-BC3FA7FE0D43",variableType:8}
 */
var T_importe = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"39892D9F-789A-447B-9828-D1942AE882E1",variableType:8}
 */
var T_iva = null;

/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"A9FDC4F5-77DC-4CE2-833F-D1A84CB5B6DB",variableType:8}
 */
var T_neto = null;

/**
 *
 * @properties={typeid:24,uuid:"FDA12923-BB44-4744-B742-794423AFC449"}
 * @AllowToRunInFind
 */
function calcular_totales()
{
	// se puede usar->
	//??databaseManager.convertToDataSet( array/ids_string/foundset,  [array_with_dataprovider_names])
	
	// arma dataset con todos lo movs
	var fs_mov= databaseManager.getFoundSet(databaseManager.getDataSourceServerName(controller.getDataSource()),'tab_mov_cl')
	fs_mov.loadAllRecords()
	fs_mov.find()
	var found_mov=fs_mov.search()
	if (found_mov == 0)
    {
	   globals.DIALOGS.showWarningDialog('Aviso','No estan cargados los tipos de movimientos de Cta. Cte.','OK')
    }
    else
    {	
	var count_mov=fs_mov.getSize()
	var tabla_mov = databaseManager.createEmptyDataSet(count_mov,2)
	
	for ( var k = 0 ; k < count_mov ; k ++ )
	{
	tabla_mov.setValue(k, 1, ' ');
	tabla_mov.setValue(k, 2, 0.00);	
	}
	
	T_neto=0
	T_iva=0
	T_importe=0
	
	// recorre foundset ctacte
	for ( var i = 1 ; i <= controller.getMaxRecordIndex(); i++ ) //? verificar
	{
	foundset.setSelectedIndex(i)
	// codigo de movimiento
	var k=ctacte_cl_to_tab_mov_cl.ctacte_mov_cl_id
	//  descripcion
	var d=ctacte_cl_to_tab_mov_cl.descripcion
	
	tabla_mov.setValue(k, 1 , d)
	tabla_mov.setValue(k, 2, tabla_mov.getValue(k, 2) + importe)
	T_importe+=importe_signo
	}
 	//para mostrar en pantalla  ver 16/4/2010 con Andy
	for ( var k = 1 ; k <= count_mov ; k ++ )
	{
	
	fIva_1=tabla_mov.getValue(1, 2)
	fIva_2=tabla_mov.getValue(2, 2)
	fIva_3=tabla_mov.getValue(3, 2)
	fIva_4=tabla_mov.getValue(4, 2)
	porc_1=tabla_mov.getValue(5, 2)
	porc_2=tabla_mov.getValue(6, 2)
	porc_3=tabla_mov.getValue(7, 2)
	porc_4=tabla_mov.getValue(8, 2)
	fNeto_1=tabla_mov.getValue(50, 2)
	fNeto_2=tabla_mov.getValue(51, 2)
	fNeto_3=tabla_mov.getValue(52, 2)
	fNeto_4=tabla_mov.getValue(53, 2)
	} 
	}               
}

/**
 * @properties={typeid:24,uuid:"A9FE0EF5-9E06-48B8-B21A-B612CE010FA6"}
 */
function imprimir() 
{
	forms.diario_vtas_2_imp.controller.showPrintPreview(false)
}
